
#ifndef MSGUTILS_COMMON_H
#define MSGUTILS_COMMON_H

namespace msgutils {

/*!
 * interface of buffer for reading
 * use exception to report error
 */
class IReadBuffer {
 public:
  virtual ~IReadBuffer(void) {}

  virtual uint8_t operator[](size_t index) const = 0;

  virtual void Drain(size_t size) = 0;

  virtual void Copyout(uint8_t* data, size_t size) = 0;

  virtual void Read(uint8_t* data, size_t size) = 0;

  virtual void Reset(void) = 0;

  virtual size_t Bytes(void) const = 0;

  virtual size_t BytesRead(void) const = 0;
};

/*!
 * interface of buffer for writing
 * use exception to report error
 */
class IWriteBuffer {
 public:
  virtual ~IWriteBuffer(void) {} 

  virtual void Write(const uint8_t* data, size_t size) = 0;

  virtual size_t Bytes(void) const = 0;

  virtual size_t BytesWrite(void) const = 0;
};

} // namespace msgutils

#endif // MSGUTILS_COMMON_H

